<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>编辑信息</title>
</head>
<body>


<form action="/user/submitAndUpdateUser" method="post">
    <div>
        <label for="username">用户名:</label>
        <input type="text" id="username" value="${user.username}" readonly>
        <!-- 隐藏字段用于提交数据,如果没有隐藏字段，username的参数值传递到controller中时将为null -->
        <input type="hidden" name="username" value="${user.username}">
    </div>
    <div>
        <label for="password">密码:</label>
        <input type="password" id="password" name="password" value="${user.password}">
    </div>
    <div>
        <label>角色:</label>
        <label>
            <input type="radio" name="role" value="user" ${user.role == 'user' ? 'checked' : ''}>
            普通用户
        </label>
        <label>
            <input type="radio" name="role" value="admin" ${user.role == 'admin' ? 'checked' : ''}>
            管理员
        </label>
    </div>
    <div>
        <input type="submit" value="更新信息">
    </div>
</form>


</body>
</html>